import { createRouter, createWebHistory } from "vue-router";
/* Layout */
import Layout from "@/layout";

const routes = [
  {
    path: "/",
    redirect: "/home",
    component: Layout,
    children: [
      {
        path: "home",
        component: () => import("@/views/Home/index.vue"),
        name: "Home"
      }
    ]
  },
  {
    path: "/account/:account_id",
    name: "Account",
    component: () => import("@/views/Home/account.vue")
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/Login/index.vue")
  },
  {
    path: "/search",
    name: "Search",
    component: () => import("@/views/Search/index.vue")
  },
  {
    path: "/game/:account_id",
    name: "Game",
    component: () => import("@/views/Game/index.vue")
  },
  {
    path: "/peer/:account_id",
    name: "Peer",
    component: () => import("@/views/Peer/index.vue")
  },
  {
    path: "/hero/:account_id",
    name: "Hero",
    component: () => import("@/views/Hero/index.vue")
  },
  {
    path: "/record/:account_id",
    name: "Record",
    component: () => import("@/views/Record/index.vue")
  },
  {
    path: "/wardmap/:account_id",
    name: "WardMap",
    component: () => import("@/views/WardMap/index.vue")
  },
  {
    path: "/wordcloud/:account_id",
    name: "WordCloud",
    component: () => import("@/views/WordCloud/index.vue")
  },
  {
    path: "/history/:account_id",
    name: "History",
    component: () => import("@/views/History/index.vue")
  },
  {
    path: "/match/:match_id",
    name: "Match",
    component: () => import("@/views/Match/index.vue")
  },
  {
    path: "/activity/list/:account_id",
    name: "Activity",
    component: () => import("@/views/Activity/list.vue")
  },
  {
    path: "/activity/week/:account_id",
    name: "Week",
    component: () => import("@/views/Activity/week.vue")
  },
  {
    path: "/activity/year/:account_id",
    name: "Year",
    component: () => import("@/views/Activity/year.vue")
  },
  {
    path: "/activity/friend/:account_id",
    name: "Friend",
    component: () => import("@/views/Activity/friend.vue")
  },
  {
    path: "/500",
    name: "500",
    component: () => import("@/views/Error/500.vue")
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/Error/404.vue")
  },
  { path: "/:catchAll(.*)", redirect: "/404" }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router;
